﻿@using TinyMoocSite.ViewModels
@model ResourceVM

@{
    ViewBag.Title = Model.Title + "|课程资源";
    Layout = "~/Views/Student/CoursePageLayout.cshtml";
}

@section Resource { active }

@section RightContainer
{
    <h4>课程资源</h4><hr />

    <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
        @foreach (ClassificatedResource list in Model.ClassificatedResourceList)
        {
            <div class="panel panel-default">
                <div class="panel-heading" role="tab" id="headingOne">
                    <h4 class="panel-title">
                        <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-@list.Id" aria-expanded="true" aria-controls="collapse-@list.Id">
                            @list.Caption
                        </a>
                    </h4>
                </div>
                <div id="collapse-@list.Id" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading-@list.Id">
                    <div class="panel-body">
                        <table class="table">
                            <thead>
                                <tr>
                                    <th>资源名称</th>
                                    <th>资源上传时间</th>
                                    <th>资源类型</th>
                                    <th>资源大小</th>
                                    <th>下载次数</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (ResourceItem item in list.ResourceList)
                                {
                                    <tr>
                                        <td>@item.Name</td>
                                        <td>@item.UploadDate</td>
                                        <td>@item.FileType</td>
                                        <td>@item.FileSize</td>
                                        <td>@item.DownloadCount</td>
                                        <td><a href="/Student/DownloadResource?Id=@item.Id">下载</a></td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        }
    </div>
}
